<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>测试表格控件</title>
    <style type="text/css">
        #dgj { height: 300px;overflow:hidden; }    
    </style>    
    <script src="../resources/scripts/jquery/jquery-1.4.2.js" type="text/javascript"></script>
    <script src="../pkgs/fj.base.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        FJ.setRootPath("../");
    </script>
    <script src="../pkgs/fj.ui.min.js" type="text/javascript"></script>
    <script src="../codes/flareJ.Datagrid.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            //表格控件
            window.oDgj = $("#dgj").DGJ({
                hasChk: true,
                hasChkAll: true,
                //isCheckOne: true,
                //lockColumn: 5,
                //lockColumnR: 8,
                widthF: "80%",
                heightF: "100%",
                columns: [
                    { text: "ID", width: 100, minWidth: 50, maxWidth: 500, dataIndex: 'c1' },
                    { text: "编号", width: 80, minWidth: 30, maxWidth: 500, dataIndex: 'c2' , asyncLoadFn: function (v, d, i, j) {    //当前列值，当前行对象，当前行号，当前列号
                        var thiz = this;

                        setTimeout(function(){
                            $.ajax({
                                type: "get",
                                cache: false,
                                url: "../resources/json/testDgj2.json",
                                success: function (data) {
                                    var data = eval("(" + data + ")");
                                    thiz.setCellData(i, 2, "c3", data.s1);
                                }
                            });

                            $.ajax({
                                type: "get",
                                cache: false,
                                url: "../resources/json/testDgj2.json",
                                success: function (data) {
                                    var data = eval("(" + data + ")");
                                    thiz.setCellData(i, 3, "c4", data.s2);
                                }
                            });
                        },1000);
                    }
                    },
                    { text: "名称", align: "center", minWidth: 10, maxWidth: 500, isAsyncLoad: true, dataIndex: 'c3' },
                    { text: "操作", width: 50, minWidth: 30, align: "left", isAsyncLoad: true, dataIndex: 'c4'}
                ],
                evts: {
                    dataLoaded: function (e, p) {
                        
                    },
                    checkedOne: function (e, p) {

                    }
                }
            });

            //加载数据
            $.ajax({
                type: "get",
                cache: false,
                url: "../resources/json/testDgj.json",
                success: function (data) {
                    var data = eval("(" + data + ")");
                    oDgj.loadData(data);
                }
            });
            
        });
    </script>
</head>
<body>
    <div id="dgj">
    </div>
</body>
</html>
